History log of /u-boot/drivers/mtd/nand/raw/stm32_fmc2_nand.c
Revision Date Author Comments
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6fa1cca7 01-May-2024 Tom Rini <trini@konsulko.com>

mtd: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# f5667d77 06-Mar-2024 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add MP25 support

FMC2 IP supports up to 4 chip select. On MP1 SoC, only 2 of them are
available when on MP25 SoC, the 4 chip select are available.

Let's use a platform data structure for parameters that will differ.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 13248d66 09-Nov-2023 Igor Prusov <ivprusov@salutedevices.com>

treewide: use linux/time.h for time conversion defines

Now that we have time conversion defines from in time.h there is no need
for each driver to define their own version.

Signed-off-by: Igor Prusov <ivprusov@salutedevices.com>
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni
Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1e94b46f 14-Sep-2023 Simon Glass <sjg@chromium.org>

common: Drop linux/printk.h from common header

This old patch was marked as deferred. Bring it back to life, to continue
towards the removal of common.h

Move this out of the common header and include it only where needed.

Signed-off-by: Simon Glass <sjg@chromium.org>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# bb035200 30-Mar-2023 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: remove unsupported EDO mode

Remove the EDO mode support from as the FMC2 controller does not
support the feature.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 7ce4f1fa 22-Feb-2022 Christophe Kerello <christophe.kerello@foss.st.com>

mtd: rawnand: stm32_fmc2: add NAND Write Protect support

This patch adds the support of the WP# signal. WP will be disabled
before the first access to the NAND flash.

Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 1cefed1e 22-Sep-2021 Tom Rini <trini@konsulko.com>

nand.h: Cleanup linux/mtd/rawnand.h usage

We only include <linux/mtd/rawnand.h> in <nand.h> for the forward
declaration of struct nand_chip, so do that directly. Then, include
<linux/mtd/rawnand.h> where required directly.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# a70c3f9f 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# b8919eaa 13-Sep-2021 Patrice Chotard <patrice.chotard@foss.st.com>

mtd: nand: raw: convert nand_dt_init() to ofnode_xx() interface

nand_dt_init() is still using fdtdec_xx() interface.
If OF_LIVE flag is enabled, dt property can't be get anymore.
Updating all fdtdec_xx() interface to ofnode_xx() to solve this issue.

For doing this, node parameter type must be ofnode.

First idea was to convert "node" parameter to ofnode type inside
nand_dt_init() using offset_to_ofnode(node). But offset_to_ofnode()
is not bijective, in case OF_LIVE flag is enabled, it performs an assert().

So, this leads to update nand_chip struct flash_node field from int to
ofnode and to update all nand_dt_init() callers.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 6a7eefeb 06-Nov-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: stm32_fmc2: migrate trace to dev and log macro

Change pr_* to dev_ or log_ macro and define LOG_CATEGORY.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 65e25bea 28-Dec-2020 Simon Glass <sjg@chromium.org>

dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()

In the spirit of using the same base name for all of these related macros,
rename this to have the operation at the end. This is not widely used so
the impact is fairly small.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 41575d8e 03-Dec-2020 Simon Glass <sjg@chromium.org>

dm: treewide: Rename auto_alloc_size members to be shorter

This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 82bf7729 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: get resources from parent node

FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 834b85c9 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use clrsetbits_le32

This patch uses clrsetbits_le32 function instead of multiple instructions.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 158f2d44 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros

This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 7a6b3288 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant

This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# 4a470044 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts

FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# a3899b37 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: remove useless inline comments

Remove inline comments that are useless since function label are
self explanatory.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# e99e812e 31-Jul-2020 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: fix a buffer overflow

The chip select defined in the device tree could only be 0 or 1.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# cd93d625 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/bitops.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# c05ed00a 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop linux/delay.h from common header

Move this uncommon header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7ae49fc 10-May-2020 Simon Glass <sjg@chromium.org>

common: Drop log.h from common header

Move this header out of the common header.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# 61b29b82 03-Feb-2020 Simon Glass <sjg@chromium.org>

dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>


# d99ea13c 21-Jun-2019 Patrick Delaunay <patrick.delaunay@st.com>

mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option

This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
- [-Wsign-compare]
- [-Wtype-limits]

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>


# 7bb75023 05-Apr-2019 Christophe Kerello <christophe.kerello@st.com>

mtd: rawnand: stm32_fmc2: add STM32 FMC2 NAND flash controller driver

The driver adds the support for the STMicroelectronics FMC2 NAND
Controller found on STM32MP SOCs.

This patch adds the polling mode, a basic mode that do not need
any DMA channels.

Only NAND_ECC_HW mode is actually supported.
The driver supports a maximum 8k page size.
The following ECC strength and step size are currently supported:
- nand-ecc-strength = <8>, nand-ecc-step-size = <512> (BCH8)
- nand-ecc-strength = <4>, nand-ecc-step-size = <512> (BCH4)
- nand-ecc-strength = <1>, nand-ecc-step-size = <512> (Extended ECC
based on Hamming)

This patch has been tested on Micron MT29F8G08ABACAH4.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>